$(function () {
    layui.use(['jquery','form','layer'],function () {
        var $ = layui.jquery
        var form = layui.form
        var layer = layui.layer

        form.on('submit(formDemo)',function (obj) {
            $.ajax({
                url:'/pages/back/comment/comment',
                type:'post',
                data:$('.layui-form').serialize(),
                success:function (data) {
                    if(data=="success"){
                        layer.msg("反馈成功",{time:1000,icon:1,end:function () {
                                window.location.href="/pages/back/comment/staffCommentPre"
                            }})
                    }else if (data=="isEmpty"){
                        layer.msg("数据有误",{time:1000,icon:2})
                    }else{
                        layer.msg("反馈失败",{time:1000,icon:2})
                    }
                }
            })
        })
    })
})